package com.xmg.p2p.base.service.impl;


import com.xmg.p2p.base.query.IplogQueryObject;
import com.xmg.p2p.base.query.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xmg.p2p.base.domain.Iplog;
import com.xmg.p2p.base.mapper.IplogMapper;
import com.xmg.p2p.base.service.IIplogService;

import java.util.List;

@Service
public class IplogServiceImpl implements IIplogService {


	@Autowired
	private IplogMapper iplogMapper;


	@Override
	public Iplog get(Long id) {
		return iplogMapper.selectByPrimaryKey(id);
	}

	@Override
	public PageResult query(IplogQueryObject qo) {
		//查出总数量
		int count = iplogMapper.queryForCount(qo);
		if(count==0){
			return PageResult.empty(qo.getPageSize());
		}

		List<Iplog> list=iplogMapper.query(qo);

		return new PageResult(list,count,qo.getCurrentPage(),qo.getPageSize());
	}

	


}
